<!DOCTYPE html>
<html lang="en">
	<head>
	
    <title>CBE BPE Toolkit - Building Information</title>

    <link href="/static/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/anytime/css/anytimec.css"/>
    <link rel="stylesheet" type="text/css" href="/static/pmp/css/plot.css"/>
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }
    </style>
    <script type="text/javascript" src="/static/jquery-1.7.2/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/static/jquery-form/jquery.form.js"></script>
    <script type="text/javascript" src="/static/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/static/sessvars/sessvars.js"></script>
    <script type="text/javascript" src="/static/anytime/js/anytimec.js"></script>
	<script type="text/javascript" src="/static/anytime/js/anytimetz.js"></script>


  </head>

  <body>
	{% include 'header.html' %}
        
		<div id='buildingForm' class='span10'>{% include 'buildingInline.html' %}</div> 
      </div><!--/row-->
      <hr>
		{% include 'footer.html' %}<br />
		
    </div><!--/.fluid-container-->

</body>
<script>
	$(document).ready(function(){
		$('#headerProject').append('<input type="image" src="/static/admin/img/icon_addlink.gif" width="10" height="10" alt="Add Another" onclick="$(\'select#id_name\').val(0); updateForm(false);">');
      	$("li#" + window.location.pathname.substring(5, window.location.pathname.length - 1)).addClass("active")
		$('select#id_name').change(function() { 
    		var projectId = $(this).val();
    		if (typeof sessvars.sessionObj != 'undefined'){sessvars.sessionObj['projectId'] = projectId;}
    		else {sessvars.sessionObj={'projectId': projectId}}
    		sessvars.$.flush() //fix for ipad issue...
    		updateForm(projectId);
	    })
	})
	 function updateForm(projectId){
	 	if (!projectId){ projectId = ""}
	 	sessvars.sessionObj['projectId'] = projectId;
		$.ajax({
			type: "POST",
			url: '/pmp/building/',
			data: {'projectId': projectId, 'select': 'select'},
			success: function(data){
				$('#buildingForm').html(data)	        
			}
		});
	}
	updateForm(sessvars.sessionObj['projectId']);
 
</script>
</html>